It is an expression with several uses, but all with the same origin: the ability of some more evolved apes to imitate the gestures they see in others. It is called a children's game where the movements of another person are repeated, also to the mockery of repeating exactly everything someone says, almost always using a forced, ridiculous or childish tone, and of course to the imitative attitude that zoologists and anthropologists study in monkeys.